package com.magic.controller;

import com.magic.process.IMeetingEvent;
import com.magic.util.R;
import com.magic.vo.MeetingVo;
import lombok.AllArgsConstructor;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author magic
 * @version 1.0
 * @date 2022/2/22 15:49
 */
@RestController
@AllArgsConstructor
@RequestMapping("/meeting")
public class MeetingController {

  @Qualifier("reserveMeetingEvent")
  private final IMeetingEvent<MeetingVo> reserveMeetingEvent;

  @Qualifier("endMeetingEvent")
  private final IMeetingEvent<MeetingVo> endMeetingEvent;

  @Qualifier("startMeetingEvent")
  private final IMeetingEvent<MeetingVo> startMeetingEvent;


  @GetMapping("/reserve")
  public R reserveMeeting(){
    reserveMeetingEvent.executeEvent(new MeetingVo());
    return R.ok("reserveMeetingEvent完成！！！！");
  }

  @GetMapping("/start")
  public R startMeeting(){
    endMeetingEvent.executeEvent(new MeetingVo());
    return R.ok("endMeetingEvent完成！！！！");
  }

  @GetMapping("/end")
  public R endMeeting(){
    startMeetingEvent.executeEvent(new MeetingVo());
    return R.ok("startMeetingEvent完成！！！！");
  }
}
